﻿// DigitalDesign
// Project: InformationBoard
// Developer: Syzdykov Sergey
// Created: 09.11.2011
// Last change: 11.11.2011
// Description: Extension methods

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Server
{
    public static partial class Extensions
    {
        public static bool ClientUpdate(this ClientDevice clientDevice, ClientNotEF clientNotEF)
        {
            try
            {
                clientDevice.PossibilityOfUpdateVideo = clientNotEF.PossibilityOfUpdateVideo;
                clientDevice.PingFrequency = clientNotEF.PingFrequency;
                clientDevice.ScreenshotFrequency = clientNotEF.ScreenshotFrequency;
                clientDevice.VideoInterruptFrequency = clientNotEF.VideoInterruptFrequency;
                clientDevice.ClassesOfPassengersId = clientNotEF.ClassOfPassengers.Id;
                clientDevice.Ticker = clientNotEF.Ticker;
                clientDevice.Location_Id = clientNotEF.ClientLocation.Id;
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        public static bool StationUpdate(this Station station, StationNotEF stationNotEF)
        {
            try
            {
                station.Address = stationNotEF.Address;
                station.Name = stationNotEF.Name;
                return true;
            }
            catch
            {
                return false;
            }
        }

        public static bool LocationUpdate(this Location location, LocationNotEF locationNotEF)
        {
            try
            {
                location.Name = locationNotEF.Name;
                location.StationId = locationNotEF.StationId;
                return true;
            }
            catch
            {
                return false;
            }
        }

    }
}
